package
{

	import flash.system.Capabilities;
	
	import kelisPkg.loadPackage.LoadEvent;
	import kelisPkg.loadPackage.MaterialsManager;
	import kelisPkg.loadPackage.TexturesManager;
	
	import overall.manager.LayerManager;
	import overall.manager.SceneManager;
	import overall.manager.ServerDataManager;
	
	import starling.display.Sprite;
	import starling.events.Event;
	
	import xnet.events.SocketEvent;
	
	public class StartGame extends Sprite
	{
		public function StartGame()
		{
			super();
			this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		private function onAddedToStage(event:starling.events.Event):void
		{
			LayerManager.instance.start(this,Capabilities.screenResolutionX,Capabilities.screenResolutionY);
			this.removeEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
			var vec:Vector.<String>=new Vector.<String>;
			vec[0]="materials/login.xml";
			MaterialsManager.instance.start();
			TexturesManager.instance.addEventListener(LoadEvent.LOAD_COMPLETE,_materialsComplete);
			TexturesManager.instance.addEventListener(LoadEvent.LOAD_PROGRESS,_loadProgress);
			TexturesManager.instance.addTextureXmlVec(vec);
		}
		private function _loadProgress(e:LoadEvent):void
		{
			trace(e.info);
		}
		private function _materialsComplete(e:LoadEvent):void
		{
			trace("加载完成");	
			trace("屏幕尺寸："+LayerManager.instance.stageWidth+","+LayerManager.instance.stageHeight);
			SceneManager.instance.show(SceneManager.RANDOM_SCENE);

		}
	}

}